package com.xgimi.open.skill.datamanager.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.xgimi.commons.base.Result;
import com.xgimi.open.skill.datamanager.biz.service.SpeechRuleBizService;
import com.xgimi.open.skill.datamanager.service.api.SpeechRuleRpcService;
import com.xgimi.open.skill.datamanager.service.request.BatchSpeechRuleReqDTO;
import com.xgimi.open.skill.datamanager.service.request.SpeechRuleReqDTO;
import com.xgimi.open.skill.datamanager.service.response.BatchSpeechRuleRespDTO;
import com.xgimi.open.skill.datamanager.service.response.SpeechRuleRespDTO;
import com.xgimi.open.skill.datamanager.service.response.page.PageResult;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author coderzpw.zhang
 * @version 1.0
 * @description 描述
 * @date 2023/3/3 14:42
 */
@Service
public class SpeechRuleRpcServiceImpl implements SpeechRuleRpcService {

    @Autowired
    private SpeechRuleBizService speechRuleBizService;

    @Override
    public Result<Boolean> addSpeechRule(SpeechRuleReqDTO speechRuleReqDTO) {
        Boolean ret = speechRuleBizService.addSpeechRule(speechRuleReqDTO);
        return new Result<>(ret);
    }


    @Override
    public Result<BatchSpeechRuleRespDTO> batchCreate(BatchSpeechRuleReqDTO batchSpeechRuleReqDTO) {
        BatchSpeechRuleRespDTO ret = speechRuleBizService.batchCreate(batchSpeechRuleReqDTO);
        return new Result<>(ret);
    }

    @Override
    public Result<PageResult<SpeechRuleRespDTO>> pageQuery(SpeechRuleReqDTO speechRuleReqDTO) {
        PageResult<SpeechRuleRespDTO> pageQuery = speechRuleBizService.pageQuery(speechRuleReqDTO);
        return new Result<>(pageQuery);
    }

    @Override
    public Result<List<SpeechRuleRespDTO>> listByIntentId(Long intentId) {
        List<SpeechRuleRespDTO> ret = speechRuleBizService.listByIntentId(intentId);
        return new Result<>(ret);
    }

    @Override
    public Result<List<SpeechRuleRespDTO>> listByIntentIds(List<Long> intentIds) {
        List<SpeechRuleRespDTO> ret = speechRuleBizService.listByIntentIds(intentIds);
        return new Result<>(ret);
    }

    @Override
    public Result<Boolean> delete(SpeechRuleReqDTO speechRuleReqDTO) {
        Boolean ret = speechRuleBizService.deleteSpeechRule(speechRuleReqDTO);
        return new Result<>(ret);
    }

    @Override
    public Result<Boolean> update(SpeechRuleReqDTO speechRuleReqDTO) {
        Boolean ret = speechRuleBizService.updateSpeechRule(speechRuleReqDTO);
        return new Result<>(ret);
    }
}
